/* eslint-disable @typescript-eslint/no-unused-expressions */
// token管理，暂时先直接存到LocalStorage里
import {
  setStorageSync,
  getStorageSync,
  removeStorageSync,
  // clearStorageSync
} from '@tarojs/taro';
// 存储key
const TOKEN_STORAGE_KEY = 'rtc_token';

export function setToken(value: string) {
  setStorageSync(TOKEN_STORAGE_KEY, value);
}

export function getToken(): string | null {
  return getStorageSync(TOKEN_STORAGE_KEY);
}

export function getTokenWithAuth(): string | null {
  return `Bearer ${getToken()}`;
}

export function removeToken() {
  removeStorageSync(TOKEN_STORAGE_KEY);
}
